import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path:'/',
    redirect:'/login'
  },
  {
    path:'/login',
    name:'login',
    component:()=>import('../views/Login.vue')
  },
  {
    path:'/register',
    name:'register',
    component:()=>import('../views/Register.vue')
  },
  {
    path:'/layout',
    name:'layout',
    component:()=>import('../views/Layout.vue'),
    children:[
      {
        path:'/home',
        name:'home',
        meta:{
          title:'首页'
        },
        component:()=>import('../views/Home.vue')
      },
      // 商品
      {
        path:'/pms',
        name:'pms',
        meta:{
          title:'商品'
        },
        component:()=>import('../views/pms/Pms.vue'),
        children:[
          // 商品列表
          {
            path:'product',
            name:'product',
            meta:{
              title:'商品列表'
            },
            component:()=>import('../views/pms/Product.vue')
          },
          // 添加商品
          {
            path:'addproduct',
            name:'addproduct',
            meta:{
              title:'添加商品'
            },
            component:()=>import('../views/pms/AddProduct.vue')
          },
          // 商品分类
          {
            path:'productcate',
            name:'productcate',
            meta:{
              title:'商品分类'
            },
            component:()=>import('../views/pms/ProductCate.vue')
          },
          // 商品类型
          {
            path:'productattr',
            name:'productattr',
            meta:{
              title:'商品类型'
            },
            component:()=>import('../views/pms/ProductAttr.vue')
          },
          // 品牌管理
          {
            path:'brand',
            name:'brand',
            meta:{
              title:'品牌管理'
            },
            component:()=>import('../views/pms/Brand.vue')
          },
          // 修改商品
          {
            path:'changeProduct/:id',
            name:'changeProduct',
            meta:{
              title:'修改商品'
            },
            component:()=>import('../views/pms/ChangeProduct.vue')
          }
        ]
      },
      // 订单
      {
        path:'/oms',
        name:'oms',
        meta:{
          title:'订单'
        },
        component:()=>import('../views/oms/Oms.vue'),
        children:[
          // 订单列表
          {
            path:'order',
            name:'order',
        meta:{
          title:'订单列表'
        },
            component:()=>import('../views/oms/Order.vue')
          },
          // 订单设置
          {
            path:'ordersetting',
            name:'ordersetting',
        meta:{
          title:'订单设置'
        },
            component:()=>import('../views/oms/OrderSetting.vue')
          },
          // 退货申请
          {
            path:'returnapply',
            name:'returnapply',
        meta:{
          title:'退货申请'
        },
            component:()=>import('../views/oms/ReturnApply.vue')
          },
          // 退货原因
          {
            path:'returnreason',
            name:'returnreason',
        meta:{
          title:'退货原因'
        },
            component:()=>import('../views/oms/ReturnReason.vue')
          },
        ]
      },
      // 营销
      {
        path:'/sms',
        name:'sms',
        meta:{
          title:'营销'
        },
        component:()=>import('../views/sms/Sms.vue'),
        children:[
          // 秒杀活动
          {
            path:'flash',
            name:'flash',
        meta:{
          title:'秒杀活动'
        },
            component:()=>import('../views/sms/Flash.vue')
          },
          // 优惠券
          {
            path:'coupon',
            name:'coupon',
        meta:{
          title:'优惠券'
        },
            component:()=>import('../views/sms/Coupon.vue')
          },
          // 品牌推荐
          {
            path:'brandrcmd',
            name:'brandrcmd',
        meta:{
          title:'品牌推荐'
        },
            component:()=>import('../views/sms/BrandRcmd.vue')
          },
          // 新品推荐
          {
            path:'new',
            name:'new',
        meta:{
          title:'新品推荐'
        },
            component:()=>import('../views/sms/New.vue')
          },
          // 人气推荐
          {
            path:'hot',
            name:'hot',
        meta:{
          title:'人气推荐'
        },
            component:()=>import('../views/sms/Hot.vue')
          },
          // 专题推荐
          {
            path:'subject',
            name:'subject',
        meta:{
          title:'专题推荐'
        },
            component:()=>import('../views/sms/Subject.vue')
          },
          // 广告列表
          {
            path:'advertise',
            name:'advertise',
        meta:{
          title:'广告列表'
        },
            component:()=>import('../views/sms/Advertise.vue')
          },
        ]
      },
      // 权限
      {
        path:'/ums',
        name:'ums',
        meta:{
          title:'权限'
        },
        component:()=>import('../views/ums/Ums.vue'),
        children:[
          // 用户列表
          {
            path:'admin',
            name:'admin',
        meta:{
          title:'用户列表'
        },
            component:()=>import('../views/ums/Admin.vue')
          },
          // 角色列表
          {
            path:'role',
            name:'role',
        meta:{
          title:'角色列表'
        },
            component:()=>import('../views/ums/Role.vue')
          },
          // 菜单列表
          {
            path:'menu',
            name:'menu',
        meta:{
          title:'菜单列表'
        },
            component:()=>import('../views/ums/Menu.vue')
          },
          // 资源列表
          {
            path:'resource',
            name:'resource',
        meta:{
          title:'资源列表'
        },
            component:()=>import('../views/ums/Resource.vue')
          },
        ]
      },
      // 权限
      {
        path:'/ums',
        name:'ums',
        meta:{
          title:'权限'
        },
        component:()=>import('../views/ums/Ums.vue'),
        children:[
          // 用户列表
          {
            path:'admin',
            name:'admin',
            meta:{
              title:'用户列表'
            },
            component:()=>import('../views/ums/Admin.vue')
          },
        ]
      }
    ]
  },
]
const router = new VueRouter({
  routes
})

export default router